﻿@page "/gantt-chart/holidays"
@using Syncfusion.Blazor.Gantt
@using ej2_blazor_defaultdata
@inherits SampleBaseComponent;

<SampleDescription>
    <p>This sample visualizes how to define the holidays in between the project timeline.</p>
</SampleDescription>
<ActionDescription>
    <p>In this example, holidays are displayed with a vertical bar with the desired text using the label property. You can also mention the continuous holidays by specifying the from and to range. For single holiday, you can define the from value alone. Also, we can display more than one holiday in the project.</p>
    <p>You can even assign the <code>CssClass</code> to each holiday to change the default color of the label and background.</p>
    <p>More information about Holidays can be found in this <code><a target='_blank' class='code' href='https://blazor.syncfusion.com/documentation/gantt-chart/holidays/'>documentation</a></code> section.</p>
</ActionDescription>

<div class="col-lg-12 control-section">
    <div class="content-wrapper">
        <div class="row">
            <SfGantt DataSource="@TaskCollection" Height="450px" Width="100%" ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd" HighlightWeekends="true">
                <GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
                                 Duration="Duration" Progress="Progress" ParentID="ParentId" Dependency="Predecessor">
                </GanttTaskFields>
                <GanttHolidays>
                    <GanttHoliday From="@Holiday1" To="@Holiday2" Label="Public holidays"></GanttHoliday>
                    <GanttHoliday From="@Holiday3" To="@Holiday4" Label="Public holiday"></GanttHoliday>
                </GanttHolidays>
                <GanttLabelSettings LeftLabel="TaskName" TValue="DefaultData.TaskData"> </GanttLabelSettings>
                <GanttSplitterSettings Position="30%"></GanttSplitterSettings>
            </SfGantt>
        </div>
    </div>
</div>

@code{
    public DateTime Holiday1 = new DateTime(2019, 04, 11);
    public DateTime Holiday2 = new DateTime(2019, 04, 12);
    public DateTime Holiday3 = new DateTime(2019, 04, 01);
    public DateTime Holiday4 = new DateTime(2019, 04, 01);
    public DateTime ProjectStart = new DateTime(2019, 3, 24);
    public DateTime ProjectEnd = new DateTime(2019, 7, 6);
    public List<DefaultData.TaskData> TaskCollection { get; set; }

    protected override void OnInitialized()
    {
        this.TaskCollection = DefaultData.ProjectNewData();
    }
}
